/*
 * @Author: Turump 
 * @Date: 2021-04-07 09:30:35 
 * @Last Modified by: Turump
 * @Last Modified time: 2021-04-26 19:48:05
 * 换父节点,即时任务
 */

import CocosHelper from "../helper/CocosHelper";
import { TaskBase } from "./TaskBase";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("任务组件/换父节点")
export default class ChangeParentTask extends TaskBase {
    @property({ displayName: "完成Emit事件", tooltip: "任务完成Emit事件", override: true, visible: false })
    doneEvent = ""

    @property({ displayName: "任务支持暂停", override: true, visible: false })
    isPauseable = false;

    @property({ displayName: "重复任务", override: true, visible: false })
    repeatableTask = false;

    @property({ type: cc.Node, displayName: "新父节点" })
    newParentNode: cc.Node = null;

    @property({displayName:"zIndex"})
    zIndex = 0;

    enableTask() {
        super.enableTask();
        CocosHelper.changeParent(this.node, this.newParentNode);
        this.node.zIndex = this.zIndex;
    }

    // update (dt) {}
}
